	<include file='Common:header' />

		<!-- /section:basics/navbar.layout -->
		<div class="main-container" id="main-container">

			<!-- #section:basics/sidebar -->

	<include file='Common:left' />
			<!-- /section:basics/sidebar -->
			<div class="main-content">
				<div class="main-content-inner">
					<div class="page-content">
							<div class="row">
							    <div class="col-xs-12">
										<div>
                                        <form id="leftnav" name="leftnav" method="post" action="{:U('leftnavorder')}" >
											<table id="dynamic-table" class="table table-striped table-bordered table-hover">
												<thead>
													<tr>
													  <th width="37%">栏目标题</th>
													  <th width="13%">开启状态</th>
													  <th width="13%">排序</th>
													  <th width="22%" style="border-right:#CCC solid 1px;">操作</th>
												  </tr>
												</thead>

												<tbody>
                                                
                                                <foreach name="arr" item="v">
													<tr>
														<td style=padding-left:<if condition='$v.leftpin neq 0'>{$v.leftpin}</if>px; >{$v.lefthtml}{$v.column_name}</span> <strong>(ID：{$v.c_id})</strong></td>
														<td>
														<if condition='$v[column_open] eq 1'>
														<a class="red" href="javascript:;" onclick="return stateyes({$v.c_id});" title="已开启">
														<div id="zt{$v.c_id}"><button class="btn btn-minier btn-yellow">开启</button></div>
														</a>
														<else/>
														<a class="red" href="javascript:;" onclick="return stateyes({$v.c_id});" title="已禁用">
														<div id="zt{$v.c_id}"><button class="btn btn-minier btn-danger">禁用</button></div>
														</a>
														</if>
														</td>
														<td><input name="{$v.c_id}" value=" {$v.column_order}" class="list_order"/></td>
														<td>
															<div class="hidden-sm hidden-xs action-buttons">
                                                            	<a class="blue" href="{:U('news_columnadd',array('c_id'=>$v['c_id']))}"  title="添加子类">
																	<i class="ace-icon fa fa-plus-circle bigger-130"></i>																</a>
																<a class="green" href="{:U('news_columnedit',array('c_id'=>$v['c_id']))}" title="修改">
																	<i class="ace-icon fa fa-pencil bigger-130"></i>																</a>
																<a class="red" href="javascript:;" onclick="return del({$v.c_id});" title="删除">
																	<i class="ace-icon fa fa-trash-o bigger-130"></i>																</a>															</div>														</td>
													</tr>
                                                 </foreach>   
                                                  <tr>
													  <td align="left"><button  id="btnorder" class="btn btn-white btn-yellow btn-sm">排序</button></td>
													  <td colspan="3"></td>
												  </tr>
												</tbody>
											</table>
                                          </form>
							    		</div>
									</div>
								</div>

<include file='Common:header_nav' />

					</div><!-- /.page-content -->
				</div>
			</div><!-- /.main-content -->

<script>
$(function(){
	$('#leftnav').ajaxForm({
		beforeSubmit: checkForm, // 此方法主要是提交前执行的方法，根据需要设置
		success: complete, // 这是提交后的方法
		dataType: 'json'
	});
	
	function checkForm(){
		//空
	}
	 
	function complete(data){
		if(data.status==1){
			layer.alert(data.info, {icon: 6}, function(index){
 			layer.close(index);
			window.location.href=data.url;
			});
		}else{
			layer.alert(data.info, {icon: 6}, function(index){
 			layer.close(index);
			window.location.href=data.url;
			});
		}
	}
 
});

function del(id){
		layer.confirm('若存在子栏目，则子栏目将一起呗删除，你确定要删除吗？', {icon: 3}, function(index){
	    layer.close(index);
	    window.location.href="__URL__/news_columndel/c_id/"+id+"";
	});
}

function stateyes(val){
		  $.post('{:U("column_state")}',
		  {x:val},
	function(data){
	var $v=val;
		if(data.status){
			if(data.info=='状态禁止'){
				var a='<button class="btn btn-minier btn-danger">禁用</button>'
				$('#zt'+val).html(a);
				return false;
			}else{
				var b='<button class="btn btn-minier btn-yellow">开启</button>'
				$('#zt'+val).html(b);
				return false;
			}
			
		}
	});
	return false;
}

</script>
	<include file='Common:footer' />
    
		</div><!-- /.main-container -->
	</body>
</html>
